package com.bw.exception;

import com.alibaba.fastjson2.JSON;
import com.bw.utils.JsonOutput;
import com.bw.utils.R;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class MyGlobalExceptionHandler {


    @ResponseBody
    @ExceptionHandler(MyRuntimeException.class)
    public R errorExceptionHandler(Exception e){
        e.printStackTrace();
        return R.ERROR(500, e.getMessage());
    }

}
